package e310

import (
	"context"
	"gitee.com/alex_li/uhf"
	"gitee.com/alex_li/uhf/stream"
)

type Client struct {
	ctx             context.Context
	io              *stream.Client
	respChan        chan byte
	notifyChan      chan byte
	respListener    func(packet Packet)
	notifyListener  func(packet Packet)
	timeoutListener func()
	lastNotify      int64
}

func New(ctx context.Context, ioStream *stream.Client) (client uhf.Sdk) {
	c := new(Client)
	c.ctx = ctx
	c.io = ioStream
	c.respChan = make(chan byte, 1)
	c.notifyChan = make(chan byte, 1)
	client = c
	go func() {
		c.packetSplit()
	}()
	return
}
